<template>
  <div id="app">
    <v-header :seller="seller"></v-header>
    <div class="tab border-bottom">
      <router-link tag="div" to="/goods" class="tab-item">商品</router-link>
      <router-link tag="div" to="/ratings" class="tab-item">评论</router-link>
      <router-link tag="div" to="/seller" class="tab-item">商家</router-link>
    </div>
    <router-view :seller="seller"/>
  </div>
</template>

<script>
  import Header from './components/header/Header'
  import Goods from './components/goods/Goods'
  const ERR_OK = 0
export default {
  name: 'App',
  data () {
    return {
        seller: {}
    }
  },
  created () {
    this.$http.get('/api/seller').then((res) => {
      res = res.body
      if (res.errno === ERR_OK) {
          this.seller = res.data
      }
    })
  },
  components: {
    'v-header': Header,
    'v-goods' : Goods
  }
}
</script>

<style lang="stylus">
  #app
    .tab
      display flex
      width 100%
      height 40px
      line-height 40px
      //border-bottom 1px solid rgba(7, 17, 27, 0.1)
      .tab-item
        flex 1
        text-align center
        font-size 14px
        color rgb(77, 85, 93)
      .active/*设置被选中后高亮*/
        color rgb(240, 20, 20)
</style>
